package gold.digger;

import gold.utils.InputUtil;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC1720 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int[] decode(int[] encoded, int first) {
            int[] arr = new int[encoded.length + 1];
            arr[0] = first;
            for (int i = 0; i < encoded.length; i++) {
                arr[i + 1] = encoded[i] ^ arr[i];
            }

            return arr;
        }
    }

    public void run() {
        Solution solution = new Solution();
        int enco[] = InputUtil.toIntegerArray("[6,2,7,3]");
        System.out.println(Arrays.toString(solution.decode(enco, 4)));
    }

    public static void main(String[] args) throws Exception {
        LC1720 an = new LC1720();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
